/**
 * 
 */
package labox.innovation.gameserver.network.clientpackets;

import labox.innovation.gameserver.model.ConsignmentCache;
import labox.innovation.gameserver.model.ConsignmentManager;
import labox.innovation.gameserver.model.actor.instance.FuzePcInstance;
import labox.innovation.gameserver.network.serverpackets.ConItemHighPacket;

/**
 * @author ljsh
 * @date 2010-5-5
 * @version 1.0
 * @description  根据类别查找寄售物品
 */
public class RequestConItemByCategory extends L2GameClientPacket {
	private static final String _C_REQUESTCONITEMBYCATEGROY = "_C_RequestConItemByCategory";

	private int type;
	/* (non-Javadoc)
	 * @see labox.innovation.gameserver.network.clientpackets.L2GameClientPacket#getType()
	 */
	@Override
	public String getType() {
		return _C_REQUESTCONITEMBYCATEGROY;
	}

	/* (non-Javadoc)
	 * @see labox.innovation.gameserver.network.clientpackets.L2GameClientPacket#readImpl()
	 */
	@Override
	protected void readImpl() {
		type = readByte();
	}

	/* (non-Javadoc)
	 * @see labox.innovation.gameserver.network.clientpackets.L2GameClientPacket#runImpl()
	 */
	@Override
	protected void runImpl() {
		FuzePcInstance active = getClient().getActiveChar();
		if (active == null)
			return;
		ConsignmentCache cache=ConsignmentManager.getSearcheCache(active.getObjectId());
		cache.reset();
		cache.init(ConItemHighPacket.BY_C, new int[]{type});
		active.sendPacket(new ConItemHighPacket(active,ConItemHighPacket.BY_C,cache.getSearchCondition()));
		ConsignmentManager.addShelveItemListener(active.getObjectId());

	}

}
